import fetch from "@/utils/fetch";

const adminlist = {
  state: {
    adminlist: []
  },
  mutations: {
    GET_ADMINLIST: (state, adminlist) => {
      state.adminlist = adminlist;
    }
  },
  actions: {
    getadminlist({ commit }) {
      return new Promise((resolve, reject) => {
        fetch
          .adminlist()
          .then(response => {
            const adminlist = response;
            commit("GET_ADMINLIST", adminlist);
            resolve(response);
          })
          .catch(error => {
            reject(error);
          });
      });
    }
  }
};

export default adminlist;
